Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

Q A
Branch? main for features / current stable version branch for bug fixes
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

@VincentLanglet VincentLanglet changed the title fix: deprecations fix: symfony deprecations Jul 3, 2025
"require": {
"php": ">=8.2",
"api-platform/metadata": "^4.1.11",
"api-platform/metadata": "^4.1.16",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AccessDeniedException was introduced in 4.1.16.
b2b5f99

{
$self = clone $this;
$self->nativeType = $nativeType;
$self->builtinTypes = PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($nativeType) ?? [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using withNativeType was triggering the symfony deprecation.

Instead we should hydrate the buildinTypes only if necessary, which means, only if getBuildinTypes is called.

This solve the deprecations.

yield 'email' => [new Email(), new ApiProperty(), true];
yield 'url' => [new Url(), new ApiProperty(), true];
if (property_exists(Url::class, 'requireTld')) {
yield 'url' => [new Url(requireTld: true), new ApiProperty(), true];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not passing requireTld imply a deprecation for sf > 7.1 ; but the property only exists since 7.1

@VincentLanglet VincentLanglet marked this pull request as ready for review July 3, 2025 22:10
@soyuka soyuka merged commit d3b98b5 into api-platform:main Jul 5, 2025
113 of 114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants